package com.zqxq.api;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;

import com.google.gson.JsonObject;
import com.zqxq.util.HttpClientHelper;
import com.zqxq.util.Signature;
import com.zqxq.util.paramSort;

import net.sf.json.JSONObject;

public class findLoanProductListAPI {
	static List<NameValuePair> data = new ArrayList<NameValuePair>();
	
	public static JsonObject findLoanProductListPost(String url) throws IOException 
	{
		JsonObject Result = null;		       
		HttpClientHelper httphelper = new HttpClientHelper();
		//请求实体排序
        paramSort ps = new paramSort();
        String paramsort = ps.sortParam(data);
        //生成签名
        Signature sign = new Signature();
        Map<String, String> signstr = sign.signatureBuild(paramsort);
        String signature = signstr.get("signature");
        String timestamp = signstr.get("timestamp");
		//登录
		LoginAPI.Login(httphelper);
		//请求时传3个参数，请求地址、请求数据和签名
		Result = HttpClientHelper.getJSONObjectByPost(url,data,signature,timestamp);
		//测试单个接口调用此方法      HttpClientHelper.closeClient();
		return Result;
		
	}

}
